home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / packet / p_aa4re / mbb35src / mbbusvc.asm < prev    next >
Encoding:
Assembly Source File  |  1988-07-24  |  6.0 KB  |  156 lines

  1. ;==========================================================================;
  2. ; Service handlers                                                         ;
  3. ;                                                                          ;
  4. ;   Copyright 1983 by William E. Westfield.  All rights reserved.          ;
  5. ;   Copyright 1986, 1987, 1988 by H. Roy Engehausen.  All rights reserved. ;
  6. ;   This software may be freely distributed and used, but it may not       ;
  7. ;   under any circumstances be sold by anyone other than the author.       ;
  8. ;   It may be distributed by a commercial company as long as it is         ;
  9. ;   for no cost.                                                           ;
  10. ;                                                                          ;
  11. ;   Permission is explicity granted to use this code as a model for        ;
  12. ;   other programs requiring interupt driven serial I/O as long as they    ;
  13. ;   carry this copyright notice.                                           ;
  14. ;==========================================================================;
  15.  
  16. rsint:
  17.  
  18.         ASSUME DS: NOTHING          ; Don't use DS
  19.         ASSUME ES: NOTHING          ; Don't use ES
  20.         ASSUME SS: NOTHING          ; Don't use SS
  21.  
  22. ;--------------------------------------------------------------------------;
  23. ; Not disabled please                                                      ;
  24. ;--------------------------------------------------------------------------;
  25.  
  26.         STI                         ;
  27.  
  28. ;--------------------------------------------------------------------------;
  29. ; See if this is our vector?                                               ;
  30. ;--------------------------------------------------------------------------;
  31.  
  32.         PUSH    SI                  ; Save SI over our loop
  33.         MOV     SI,OFFSET com_start ;
  34.  
  35. com_srch_loop:                      ;
  36.  
  37.         CMP     DL,CS:comnumber[SI] ; Is this our port?
  38.         JE      rsint_ours          ; Yes...
  39.  
  40.         MOV     SI,CS:com_next[SI]  ; Increment to next com port block
  41.  
  42.         CMP     SI,0                ; Anything left to be checked?
  43.         JNE     com_srch_loop       ; Yep....
  44.  
  45. ;--------------------------------------------------------------------------;
  46. ; Not us.. Pop things out and call regular handler                         ;
  47. ;--------------------------------------------------------------------------;
  48.  
  49. not_us:
  50.  
  51.         POP     SI                  ; Pop SI
  52.         JMP     CS:DWORD PTR old_bios_vector
  53.  
  54. ;--------------------------------------------------------------------------;
  55. ; SI now contains the pointer to the com block...  See what                ;
  56. ; the user has requested and we may or may not do it.......                ;
  57. ;--------------------------------------------------------------------------;
  58.  
  59. rsint_ours:
  60.  
  61.         PUSH    DX                  ; We need the DX register
  62.         PUSH    CX                  ; We need the CX register
  63.         PUSH    BX                  ; We need the BX register
  64.         PUSH    ES                  ; We need the ES register
  65.         PUSH    DS                  ; We need the DS register
  66.         PUSH    DI                  ; We need the DI register
  67.  
  68.         MOV     BX,CS               ; Transfer CS to DS
  69.         MOV     DS,BX               ; via BX
  70.       ASSUME DS: everything         ; We now have DS working
  71.  
  72. ;--------------------------------------------------------------------------;
  73. ; Stack offsets to registers                                               ;
  74. ;--------------------------------------------------------------------------;
  75.  
  76. stack_di = 0
  77. stack_ds = 2
  78. stack_es = 4
  79. stack_bx = 6
  80. stack_cx = 8
  81. stack_dx = 10
  82.  
  83. ;--------------------------------------------------------------------------;
  84. ; If an 8250, QuadPort, or 4 Async Port, use the 8250 routines             ;
  85. ;--------------------------------------------------------------------------;
  86.  
  87.  IF present_8250
  88.  
  89.         CMP     chip[SI],chip_8250
  90.         JE      rsint_8250
  91.         CMP     chip[SI],chip_qrqp
  92.         JE      rsint_8250
  93.         CMP     chip[SI],chip_4apc
  94.         JE      rsint_8250
  95.  
  96.         JMP     rsint_not_8250
  97. rsint_8250:
  98.  
  99.    INCLUDE 8250SVC.ASM;             ; 8250 services
  100.  
  101. rsint_not_8250:
  102.  
  103.  ENDIF
  104.  
  105. ;--------------------------------------------------------------------------;
  106. ; If an 8530 then use 8530 routines!                                       ;
  107. ;--------------------------------------------------------------------------;
  108.  
  109.  IF present_8530
  110.  
  111.         CMP     chip[SI],chip_8530
  112.         JE      rsint_8530
  113.         JMP     rsint_not_8530
  114.  
  115. rsint_8530:
  116.  
  117.    INCLUDE 8530SVC.ASM;             ; 8530 services
  118.  
  119. rsint_not_8530:
  120.  
  121.  ENDIF
  122.  
  123. ;--------------------------------------------------------------------------;
  124. ; Interrupt exit -- Used when interrupt is serviced                        ;
  125. ;--------------------------------------------------------------------------;
  126.  
  127. rsint_exit:
  128.  
  129.       ASSUME DS: NOTHING            ; DS now invalid
  130.  
  131.         POP     DI                  ; Restore registers
  132.         POP     DS                  ;
  133.         POP     ES                  ;
  134.         POP     BX                  ;
  135.         POP     CX                  ;
  136.         POP     DX                  ;
  137.         POP     SI                  ;
  138.         IRET                        ;      and leave
  139.  
  140. ;--------------------------------------------------------------------------;
  141. ; Interrupt exit -- Used when interrupt is not serviced to call next in    ;
  142. ;                   the chain.                                             ;
  143. ;--------------------------------------------------------------------------;
  144.  
  145. rsint_exit_not_us:
  146.  
  147.       ASSUME DS: NOTHING            ; DS now invalid
  148.  
  149.         POP     DS                  ; Restore registers
  150.         POP     ES                  ;
  151.         POP     BX                  ;
  152.         POP     CX                  ;
  153.         POP     DX                  ;
  154.         POP     SI                  ;
  155.         JMP     CS:DWORD PTR old_bios_vector ; This way out
  156.